package com.dengqi.mymodule.activity.network.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.dengqi.mymodule.R;
import com.dengqi.mymodule.activity.network.adapter.BaseAdapter;
import com.dengqi.mymodule.activity.network.adapter.SpecsAdapter;
import com.dengqi.mymodule.activity.network.bean.CardBean;
import com.dengqi.mymodule.activity.network.bean.ServiceBean;
import com.dengqi.mymodule.activity.network.module.CardContract;
import com.dengqi.mymodule.activity.network.module.CardPresenter;
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;

import java.util.List;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

/**
 * @Author: dengqi
 * @CreateDate: 2020/10/19 17:25
 * @Description: 单项目详情
 */
public class SingleDetailActivity extends RxAppCompatActivity implements CardContract.CardView {

    private ImageView iv_pic;
    private TextView tv_title, tv_price, tv_time, tv_salesman;
    private EditText et_num;
    private RecyclerView recyclerView;
    private SpecsAdapter<ServiceBean> adapter;

    private CardPresenter cardPresenter;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_single_detail);

        cardPresenter = new CardPresenter(this);

        iv_pic = findViewById(R.id.iv_pic);
        tv_title = findViewById(R.id.tv_title);
        tv_price = findViewById(R.id.tv_price);
        tv_time = findViewById(R.id.tv_time);
        tv_salesman = findViewById(R.id.tv_salesman);
        et_num = findViewById(R.id.et_num);
        
        recyclerView = findViewById(R.id.recyclerView);
        adapter = new SpecsAdapter<>();
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(adapter);

        cardPresenter.getCardList(this);
    }

    @Override
    public String getShopId() {
        return "1";
    }

    @Override
    public String getStatus_() {
        return "2";
    }

    @Override
    public String getCardType() {
        return "1";
    }

    @Override
    public void onCardList(List<CardBean> result) {

    }

    @Override
    public void onServiceList(List<ServiceBean> result) {
        adapter.setData(result);
        adapter.notifyDataSetChanged();
    }

}
